package view;

import java.awt.Component;
import java.io.File;
import java.util.ResourceBundle;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;

/**
 * 
 * @author Andrea Scripa
 * 
 */
public class Background {
	ResourceBundle myAcceptedTypes = ResourceBundle
			.getBundle("resources.slogoMultimedia");
	ResourceBundle myErrors = ResourceBundle
			.getBundle("resources.errorMessages");
	private File selectedFile;

	public void execute() {
		JFileChooser chooser = new JFileChooser();

		FileNameExtensionFilter filter = new FileNameExtensionFilter(
				myAcceptedTypes.getString("PictureFileFilter"), myAcceptedTypes
						.getString("AcceptedPicType1"), myAcceptedTypes
						.getString("AcceptedPicType2"));
		chooser.setFileFilter(filter);

		Component parent = null;
		int returnVal = chooser.showOpenDialog(parent);
		if (returnVal == JFileChooser.APPROVE_OPTION) {
			selectedFile = chooser.getSelectedFile();
		}
	}

	public String returnSelectedBackground() {
		return selectedFile.getPath();
	}

}
